package laba1.task2;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author yakimovich
 */
public abstract class Figure {

    private List<Point> points = new ArrayList<>();

    /**
     *
     * @return the List of tops of the Figure
     */
    public List<Point> getList() {
        return getPoints();
    }

    /**
     * displays the coordinates of the Figure on the screen
     */
    public abstract void draw();

    /**
     * move this Figure at location (x + dx, y + dy).
     *
     * @param dx the distance to move this Figure along the X axis
     * @param dy the distance to move this Figure along the Y axis
     */
    public void move(int dx, int dy) {
        for (Point p : getPoints()) {
            if (p != null) {
                p.shift(dx, dy);
            }
        }
    }

    /**
     * scales the Figure by a factor
     *
     * @param factor scaling factor
     */
    public abstract void scale(int factor);

    /**
     * @return the points
     */
    public List<Point> getPoints() {
        return points;
    }

    /**
     * @param points the points to set
     */
    public void setPoints(List<Point> points) {
        this.points = points;
    }
}
